/*
 * @Descripttion:
 * @version:
 * @Author: QYFeng
 * @Date: 2021-04-19 22:28:37
 * @LastEditors: QYFeng
 * @LastEditTime: 2021-04-19 23:26:56
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 以下代码解决路由地址重复点击的报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('../views/index.vue'),
    meta: { tab: '1', title: '首页' }
  },
  {
    path: '/companyProfile',
    name: 'companyProfile',
    component: () => import('../views/companyProfile.vue'),
    meta: { tab: '2-1', title: '公司简介' }
  },
  {
    path: '/corporateBusiness',
    name: 'corporateBusiness',
    component: () => import('../views/corporateBusiness.vue'),
    meta: { tab: '2-2', title: '公司业务' }
  },
  {
    path: '/corporateBusinessDetail',
    name: 'corporateBusinessDetail',
    component: () => import('../views/corporateBusinessDetail.vue'),
    meta: { tab: '2-2', title: '公司业务-详情' }
  },
  {
    path: '/brief',
    name: 'brief',
    component: () => import('../views/brief.vue'),
    meta: { tab: '2-3', title: '简讯' }
  },
  {
    path: '/briefDetail',
    name: 'briefDetail',
    component: () => import('../views/briefDetail.vue'),
    meta: { tab: '2-3', title: '简讯详情' }
  },
  {
    path: '/administrativeLicensing',
    name: 'administrativeLicensing',
    component: () => import('../views/administrativeLicensing.vue'),
    meta: { tab: '2-4', title: '行政许可' }
  },
  {
    path: '/staffSearch',
    name: 'staffSearch',
    component: () => import('../views/staffSearch.vue'),
    meta: { tab: '3', title: '员工查询' }
  },
  {
    path: '/wordOrder',
    name: 'wordOrder',
    component: () => import('../views/wordOrder.vue'),
    meta: { tab: '4', title: '工单递交' }
  },
  {
    path: '/homeVisits',
    name: 'homeVisits',
    component: () => import('../views/homeVisits.vue'),
    meta: { tab: '5', title: '上门拜访' }
  },
  {
    path: '/socialRecruitment',
    name: 'socialRecruitment',
    component: () => import('../views/socialRecruitment.vue'),
    meta: { tab: '6', title: '社会招聘' }
  },
  {
    path: '/socialRecruitmentDetail',
    name: 'socialRecruitmentDetail',
    component: () => import('../views/socialRecruitmentDetail.vue'),
    meta: { tab: '6', title: '社会招聘-详情' }
  },
  {
    path: '/productService',
    name: 'productService',
    component: () => import('../views/productService.vue'),
    meta: { tab: '7', title: '产品与服务' }
  },
  {
    path: '/contactUs',
    name: 'contactUs',
    component: () => import('../views/contactUs.vue'),
    meta: { tab: '8', title: '联系我们' }
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
